home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / tutor / ada1tutr.arj / TOMORROW.ANS (.png) < prev    next >
ANSI Art File  |  1992-09-04  |  876b  |  640x320  |  1-bit (2 colors)
Labels: text | screenshot | font
OCR: Our solution to Outside Assignment 3: separate (NEXTDATE) function TOMORROW (TODAY: in DATE) return DATE is LENGTH: array(MONTH_TYPE) of DAY_SUBTYPE := (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); ANSWER: DATE: if TODAY. YEAR mod 4 = 0 and (TODAY. YEAR mod 100 /= 0 or TODAY. YEAR mod 400 = 0) then LENGTH(FEB) := 29; end if; if TODAY.DAY /= LENGTH(TODAY.MONTH) then -- Not end of month. DEC then ANSWER := (TODAY.DAY + 1, TODAY.MONTH, TODAY. YEAR); elsif TODAY.MONTH End of month, but not end of year. ANSWER := (1, MONTH_TYPE' SUCC (TODAY.MONTH), TODAY. YEAR else —— End of year. ANSWER := (1, JAN, TODAY.YEAR + 1); end if; return ANSWER: begin end TOMORROW;